package com.security.demo.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author H
 * @date 2023/1/12
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    // 增加映射关系
    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        // 使得/login/page映射为login.jsp
        registry.addViewController("/login/page").setViewName("login");
        // 使得/logout映射为logout.jsp
        registry.addViewController("/logout/page").setViewName("welcome");
    }
}
